﻿<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');

class Admin_model extends CI_Model {
		
	public function __constructor()
	{  
	    parent::Model();  
	}
	
	function check_id($email,$password)
	{
		$this->db->where('user_email',$email);
		$this->db->where('user_password',$password);
		$q = $this->db->get('land_user_login');
		if ($q->num_rows()>0) 
		{
			return TRUE;
		}
		else {
			return false;
		}
	}
	
	function list_user()
	{	
		//$this->db->order_by('landing_mail','asc'); // optional
		$query =  $this->db->get('landing_user');
		$this->row_count = $query->num_rows();
		if($query->num_rows() > 0)
		{
			foreach($query->result() as $row)
			{
				$data[] = $row;
			}
		return $data;
		}
	}
	
	function get_user_edit($id)
	{
		$this->db->where('id_login',$id);
		$q = $this->db->get('land_user_login');
		if ($q->num_rows()>0) 
		{
			$row = $q->row();
			return $row;
		}
		
	}
	
	function utilisateurs()
	{	
		//$this->db->order_by('landing_mail','asc'); // optional
		$query =  $this->db->get('land_user_login');
		$this->row_count = $query->num_rows();
		if($query->num_rows() > 0)
		{
			foreach($query->result() as $row)
			{
				$data[] = $row;
			}
		return $data;
		}
	}
	
	
	function check_email($data)
	{
		$this->db->where('user_email',$data);
		$q = $this->db->get('land_user_login');
		if ($q->num_rows()>0) 
		{
			return TRUE;
		}
	}
	
	function add_user($data)
	{
		$this->db->insert('land_user_login',$data);
		
	}
	
	
}
?>